{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    .asljasd .col-sm-9,.asljasd .col-sm-3{
        font-size: 14px;
        padding:5px 15px;
    }
    .form-group{
        overflow: hidden;
    }
    .col-sm-6{
        margin-bottom: 30px;
    }
    .ibox-content{
        height: 500px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>付款信息</h5>
        </div>
        <div class="ibox-content">
            <div class="row asljasd">
                <div class="col-sm-12">
                    <div class="col-sm-3">订单号：</div>
                    <div class="col-sm-9">{$name.number}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">商品金额：</div>
                    <div class="col-sm-9">{:_money($name.total)}元</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">订单运费：</div>
                    <div class="col-sm-9">{:_money($name.postage)}元</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">支付金额：</div>
                    <div class="col-sm-9" style="color:red">{:_money($name.money)}元</div>
                </div>
                {if condition="$name.des_volley > 0"}
                <div class="col-sm-12">
                    <div class="col-sm-3">金币抵扣：</div>
                    <div class="col-sm-9">{:_money($name.des_volley)}</div>
                </div>
                {/if}
                {if condition="$name.des_score > 0"}
                <div class="col-sm-12">
                    <div class="col-sm-3">积分抵扣：</div>
                    <div class="col-sm-9">{:_money($name.des_score)}</div>
                </div>
                {/if}
                {if condition="$name.dikou > 0"}
                <div class="col-sm-12">
                    <div class="col-sm-3">总共抵扣：</div>
                    <div class="col-sm-9">{:_money($name.dikou)}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">抵扣比例：</div>
                    <div class="col-sm-9">1：{:floatval($name.des_rate)}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">抵扣金额：</div>
                    <div class="col-sm-9">{:_money($name.dikou / $name.des_rate)} 元</div>
                </div>
                {/if}
                <div class="col-sm-12">
                    <div class="col-sm-3">留言备注：</div>
                    <div class="col-sm-9" style="color:red">{$name.remark}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">创建时间：</div>
                    <div class="col-sm-9">{$name.create_time|date='Y-m-d H:i:s',###}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">支付用户：</div>
                    <div class="col-sm-9" style="color:red">
                    {if condition="$name['types']==2 || $name['to_user']!=$name['uid']"}
                        {$name.to_user}
                    {else}
                        {$name.uid}
                    {/if}
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">状态：</div>
                    <div class="col-sm-9">
                        {switch name="name.status"}
                        {case value="-3"}<span class='btn btn-default btn-xs'>超&nbsp;&nbsp;&nbsp;时</span>{/case}
                        {case value="-2"}<span class='btn btn-default btn-xs'>取&nbsp;&nbsp;&nbsp;消</span>{/case}
                        {case value="-1"}<span class='btn btn-default btn-xs'>失&nbsp;&nbsp;&nbsp;败</span>{/case}
                        {case value="1"}<span class='btn btn-primary btn-xs'>已付款</span>{/case}
                        {case value="2"}<span class='btn btn-primary btn-xs'>已发货</span>{/case}
                        {case value="3"}<span class='btn btn-primary btn-xs'>已签收</span>{/case}
                        {default /}<span class='btn btn-default btn-xs'>待付款</span>
                        {/switch}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>商品信息</h5>
        </div>
        <div class="ibox-content">
            <div class="row asljasd">
                <a class="col-sm-12" style="display: flex;align-items: center;">
                    <div class="col-sm-3">图片</div>
                    <div style="display: flex;align-items: center;width: 75%;justify-content: space-between;">
                        <div class="col-sm-3">商品ID</div>
                        <div class="col-sm-3">商品名称</div>
                        <div class="col-sm-3">价格</div>
                        <div class="col-sm-3">规格</div>
                        <div class="col-sm-3">数量</div>
                    </div>
                </a>
            </div>
            {volist name='shop' id='v'}
                <div class="row asljasd">
                <a href="{$v.url}" target="_blank" class="col-sm-12" style="display: flex;align-items: center;">
                    <div class="col-sm-3"><img src="__ROOT__{$v.image}" alt="" width="100%" height="100%"></div>
                    <div style="display: flex;align-items: center;width: 75%;justify-content: space-between;">
                        <div class="col-sm-3">商品ID: {$v.goods_id}</div>
                        <div class="col-sm-3">{:_substr(strip_tags($v.name))}</div>
                        <div class="col-sm-3">{:_money($v['price'])}</div>
                        <div class="col-sm-3">{$v.sku}</div>
                        <div class="col-sm-3">{$v.num}件</div>
                    </div>
                </a>
            </div>
            {/volist}
        </div>
    </div>
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>订单所属用户资料</h5>
        </div>
        <div class="ibox-content">
            <div class="row m-b-lg">
                <div class="col-lg-8">
                    <ul class="list-group clear-list">
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$member.id}</span> 用户ID:
                        </li>
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$member.name}</span> 昵称
                        </li>
                        <li class="list-group-item">
                            <span class="pull-right"> {$member.phone} </span> 手机：
                        </li>
                    </ul>
                </div>
                <div class="col-lg-4 text-center">
                    <div class="m-b-sm">
                        <img alt="image" class="img-circle" src="__ROOT__{$member.head_100}" style="width: 62px">
                    </div>
                </div>
            </div>
            {if condition="$name['types']==2 || $name['to_user']!=$name['uid']"}
            <div class="row m-b-lg">
                <div class="col-lg-8">
                    {if condition="$name['to_user']!=$name['uid']&&$name['gateway']==5"}
                    <br><br><br><span style="color: red;">代付方</span><br><br>
                    {elseif condition="$name['address']"}
                    <br><br><br><span style="color: red;">赠送方</span><br><br>
                    {else}
                    <br><br><br><span style="color: red;">接收方</span><br><br>
                    {/if}
                    <ul class="list-group clear-list">
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$name.to_user}</span> 用户ID:
                        </li>
                        {if condition="$to_user"}
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$to_user.name}</span> 昵称
                        </li>
                        <li class="list-group-item">
                            <span class="pull-right"> {$to_user.phone} </span> 手机：
                        </li>
                        {/if}
                    </ul>

                </div>
                <div class="col-lg-4 text-center">
                    <div class="m-b-sm">
                        {if condition="$to_user"}
                        <img alt="image" class="img-circle" src="{:_imgUrl()}{$to_user.head_100}" style="width: 62px">
                        {/if}
                    </div>
                </div>
            </div>
            {/if}
        </div>
    </div>
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>发货</h5>
        </div>
        <div class="ibox-content">
            <div class="row asljasd">
                <div class="col-sm-12">
                    <div class="col-sm-3">姓名：</div>
                    <div class="col-sm-9">{$name.address.receiver}</div>
                </div>
            </div>
            <div class="row asljasd">
                <div class="col-sm-12">
                    <div class="col-sm-3">手机：</div>
                    <div class="col-sm-9">{$name.address.mobile}</div>
                </div>
            </div>
            <div class="row asljasd">
                <div class="col-sm-12">
                    <div class="col-sm-3">地址：</div>
                    <div class="col-sm-9">{$name.address.area} {$name.address.address}</div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">快递公司</label>
                <div class="col-sm-9">
                    <input name="tracking_name" type="text" class="form-control" value="{$name.tracking_name}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">快递单号</label>
                <div class="col-sm-9">
                    <input name="tracking_number" type="text" class="form-control" value="{$name.tracking_number}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">状态设置</label>
                <div class="col-sm-4">
                    <select class="form-control" name="status">
                        <option value="-4" {eq name='name.status' value="-4" }selected{/eq}>已退款</option>
                        <option value="-3" {eq name='name.status' value="-3" }selected{/eq}>超&nbsp;&nbsp;&nbsp;时</option>
                        <option value="-2" {eq name='name.status' value="-2" }selected{/eq}>取&nbsp;&nbsp;&nbsp;消</option>
                        <option value="-1" {eq name='name.status' value="-1" }selected{/eq}>失&nbsp;&nbsp;&nbsp;败</option>
                        <option value="0" {eq name='name.status' value="0" }selected{/eq}>待付款</option>
                        <option value="1" {eq name='name.status' value="1" }selected{/eq}>已付款</option>
                        <option value="2" {eq name='name.status' value="2" }selected{/eq}>已发货</option>
                        <option value="3" {eq name='name.status' value="3" }selected{/eq}>已签收</option>
                    </select>
                </div>
            </div>
            <div style="clear: both; margin: 20px auto; width: 180px;"><div style="width: 100%" class="btn btn-primary" id="data">提交</div></div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
    $(document).ready(function(){
        $('#data').click(function(){
            var tracking_number = $("[name='tracking_number']").val();
            var tracking_name = $("[name='tracking_name']").val();
            var status = $("select[name='status']").val();

            $.ajax({
                type: 'post',
                url: '{:url('dingdanAdd')}',
                data: {
                    tracking_number:tracking_number,
                    tracking_name: tracking_name,
                    status:status,
                    id:{$name.id}
                },
                dataType: 'json',
                success:function(ret){
                    if (ret.ret) {
                        swal_msg(ret.ret,'',"success",0)
                    } else {
                        layer.msg(ret.err)
                    }
                },
            });
        })

    });
</script>
 